import fs from 'fs';
import path from 'path';



const ReadFonfig = () => {
    var File = fs.readFileSync(path.resolve('swagger.config.js'), 'utf-8');
    return new Function(File)();
}

export default function (options) {
    let config = {};
    var _path = 'swagger.config.js';
    if (options.config) {
        _path = options.config;
    }

    // 配置文件如果存在则读取
    if (fs.existsSync(path.resolve(_path))) {
        config = ReadFonfig();
        return config;
    } else {
        

        return undefined;
    };

};